home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / comm / 110a115a.zip / SCRIPTS.ZIP / VDEMO.SLT < prev    next >
Text File  |  1995-12-21  |  3KB  |  79 lines

  1. /****************************************************************/
  2. /*                                                              */
  3. /*  Demo of how to use various video display, cut, paste, and   */
  4. /*  other video manipulations.                                  */
  5. /*                                                              */
  6. /*                   Copyright 1995 deltaComm Development, Inc. */
  7. /*                                                              */
  8. /****************************************************************/
  9.  
  10. main()
  11. {
  12.  int c, d, e, m, o;
  13.  str dem[8];
  14.  int dp, ep, mp, op;
  15.  
  16.  clear_scr();                             // Clear screen
  17.  gotoxy(10, 10);                          // Move to position 10, 10
  18.  c=_fore_color;                           // Save & change
  19.  _fore_color=5;                           // color
  20.  printsc("DEMO");
  21.  _fore_color=c;
  22.  
  23.  vgetchrs(10, 10, dem, 0, 4);             // Read characters from screen
  24.  for (c=11; c<20; c=c+1)                  // Loop, printing chars on
  25.   vputchrs(10, c, dem, 0, 4, c-10);       // successive lines in colors
  26.  
  27.  vgetchrsa(10, 10, dem, 0, 4);            // Read chars from screen in color
  28.  
  29.  gotoxy(10, 10);
  30.  d=vgetchr();                             // Read one char including color
  31.  gotoxy(11, 10);                          // Lather, rinse, repeat 4 times
  32.  e=vgetchr();
  33.  gotoxy(12, 10);
  34.  m=vgetchr();
  35.  gotoxy(13, 10);
  36.  o=vgetchr();
  37.  
  38.  dp=ep=mp=op=10;                          // set all four of these ints to 10
  39.  
  40.  while ((dp<20) or (ep<20) or (mp<20) or (op<20))
  41.   {                                       // Loop while any not complete
  42.    c=random(4)+1;                         // Select one of the four randomly
  43.  
  44.    if ((c==1) and (dp<20))                // Test if our random selection has
  45.     {                                     // been incremented to 20.  If not,
  46.      dp=dp+1;                             // Increment position one, and then
  47.      gotoxy(10, dp);                      // go there.  Put the "d" character
  48.      vputchr(d);                          // on-screen, delay 1/5 second, and
  49.      delay(2);                            // move on through the loop.
  50.     }
  51.  
  52.    if ((c==2) and (ep<20))                // Each letter, D, E, M, O, needs to
  53.     {                                     // be tested in the same manner.  The
  54.      ep=ep+1;                             // end result is an interesting
  55.      gotoxy(11, ep);                      // video "DEMO"....
  56.      vputchr(e);
  57.      delay(2);
  58.     }
  59.  
  60.    if ((c==3) and (mp<20))
  61.     {
  62.      mp=mp+1;
  63.      gotoxy(12, mp);
  64.      vputchr(m);
  65.      delay(2);
  66.     }
  67.  
  68.    if ((c==4) and (op<20))
  69.     {
  70.      op=op+1;
  71.      gotoxy(13, op);
  72.      vputchr(o);
  73.      delay(2);
  74.     }
  75.   }
  76.  
  77.  vputchrsa(10, 21, dem, 0, 4);            // Put all chars on-screen in color
  78. }
  79.